oo::class create AppMenuBar {
    superclass Monitor
    variable MenuBar MenuObjs

    constructor {parent menuTypes} {
	set MenuBar [menu $parent.menubar -tearoff 0]
	$parent configure -menu $MenuBar
	
	foreach type $menuTypes {
	    if [my ifMenuTypeSupported? $type] {
		lappend MenuObjs [$type new $MenuBar]
	    }
	}
    }

    method setNotebook {nbObj} {
	foreach obj $MenuObjs {
	    $obj setNotebook $nbObj
	}
    }

    method ifMenuTypeSupported? {type} {
	foreach c [info class subclasses AppMenu] {
	    if {$type == [string trimleft $c :]} {
		return 1
	    }
	}
	return 0
    }
    
    method update {textWidget langObj} {
	foreach obj $MenuObjs {
	    $obj update $textWidget $langObj
	}
    }

    destructor {
	foreach obj $MenuObjs {
	    $obj destroy
	}
    }
}